using System;
using Glue;
using Xunit;

namespace GlueTests.MapperVerificationTests
{
    public class When_mapping_should_work
    {
        private readonly Mapping<DomainPerson, GuiPerson> mapping;
        private readonly IMapperVerification<DomainPerson, GuiPerson> verification;

        public class DomainPerson { public String FirstName { get; set; } }
        public class GuiPerson { public String FirstName { get; set; } }

        public When_mapping_should_work()
        {
            mapping = new Mapping<DomainPerson, GuiPerson>();
            verification = mapping.GetMapperVerification();
        }

        [Fact]
        public void Should_verify_when_no_relations_exists()
        {
            verification.AssertMapsCorrectlyTowards(new GuiPerson());
            verification.AssertMapsCorrectlyTowards(new DomainPerson());
        }

        [Fact]
        public void Should_verify_when_relations_exists()
        {
            mapping.AutoRelateEqualNames();
            verification.AssertMapsCorrectlyTowards(new GuiPerson());
            verification.AssertMapsCorrectlyTowards(new DomainPerson());
        }
    }
}